package com.example.dingtalkwebproject.controller;

import com.example.dingtalkwebproject.pojo.dParOptionType;
import com.example.dingtalkwebproject.service.dParOptionTypeService;
import com.example.dingtalkwebproject.utils.AjaxResult;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/account")
public class getPayAccountController {

    @Autowired
    private dParOptionTypeService dParOptionTypeService;

    @GetMapping("/getAllPayAccount")
    public AjaxResult getAllPayAccountList() {
        List<dParOptionType> dParOptionTypes = dParOptionTypeService.selectAllPayAccountList();
        if (ObjectUtils.isEmpty(dParOptionTypes)) {
            return AjaxResult.error("未获取到当前扣款账户信息!");
        }
        return AjaxResult.success(dParOptionTypes);
    }
}
